group { name: "e/widgets/syscon/main";
   parts {
      part { name: "bg"; type: RECT;
         description { state: "default" 0.0;
            color_class: "/bg/normal/syscon";
         }
      }
      part { name: "e.swallow.main"; type: SWALLOW;
         scale: 1;
         description { state: "default" 0.0;
            rel1.offset: 8 8;
            rel2.offset: -9 8;
            rel2.relative: 1.0 0.0;
            align: 0.5 0.0;
            fixed: 0 1;
            offscale;
         }
      }
      part { name: "e.swallow.secondary"; type: SWALLOW;
         scale: 1;
         description { state: "default" 0.0;
            rel.to: "e.swallow.main";
            rel1.relative: 0.0 1.0;
            align: 0.5 0.0;
            fixed: 0 1;
            offscale;
         }
      }
      part { name: "e.swallow.extra"; type: SWALLOW;
         scale: 1;
         description { state: "default" 0.0;
            rel1.to: "e.swallow.secondary";
            rel1.relative: 0.0 1.0;
            rel2.to: "e.swallow.secondary";
            align: 0.5 0.0;
            fixed: 0 1;
            offscale;
         }
      }
      part { name: "e.text.label"; type: TEXT;
         scale: 1;
         description { state: "default" 0.0;
            rel1.offset: 0 16;
            rel1.relative: 0.5 0.0;
            rel1.to_y: "e.swallow.extra";
            rel2.offset: -1 -17;
            rel2.relative: 0.5 1.0;
            align: 0.5 1.0;
            color_class: "/fg/normal/syscon/text";
            text { font: FN; size: 10;
               min: 1 1;
               ellipsis: -1;
               align: 0.5 0.5;
               text_class: "button";
            }
            fixed: 1 0;
            offscale;
         }
         description { state: "clicked" 0.0;
            inherit: "default" 0.0;
            color_class: "/fg/pressed/syscon/text";
         }
      }
      part { name: "button"; type: RECT;
         scale: 1;
         description { state: "default" 0.0;
            rel1.to: "e.text.label";
            rel1.offset: -12 -12;
            rel2.to: "e.text.label";
            rel2.offset: 11 11;
            color: 255 255 255 0; // no cc
            offscale;
         }
      }
   }
   programs {
      program { signal: "mouse,down,1*"; source: "button";
         action: STATE_SET "clicked" 0.0;
         target: "e.text.label";
      }
      program { signal: "mouse,up,1"; source: "button";
         action: STATE_SET "default" 0.0;
         target: "e.text.label";
      }
      program { signal: "mouse,clicked,1*"; source: "button";
         action: SIGNAL_EMIT "e,action,close" "";
      }
   }
}

group { name: "e/widgets/syscon/item/button";
   alias: "e/desklock/pin_button";
   parts {
      part { name: "clip"; type: RECT; mouse_events: 0;
         description { state: "default" 0.0;
         }
      }
      part { name: "icon_clip"; type: RECT;
         description { state: "default" 0.0;
            color: 255 255 255 255; // no cc
         }
         description { state: "disabled" 0.0;
            inherit: "default" 0.0;
            color: 255 255 255 64; // no cc
         }
      }
      part { name: "e.swallow.icon"; type: SWALLOW; mouse_events: 0;
         clip_to: "icon_clip";
         scale: 1;
         description { state: "default" 0.0;
            align: 0.5 0.0;
            rel1.offset: 5 5;
            rel2.relative: 1.0 0.0;
            rel2.offset: -6 -6;
            rel2.to_y: "e.text.label";
            aspect: 1.0 1.0; aspect_preference: VERTICAL;
            offscale;
         }
      }
      part { name: "e.text.label"; type: TEXT; mouse_events: 0;
         scale: 1;
         description { state: "default" 0.0;
            rel1.relative: 0.0 1.0;
            rel1.offset: 8 -9;
            rel2.offset: -9 -9;
            align: 0.5 1.0;
            color_class: "/fg/normal/syscon/button/text";
            text { font: FN; size: 10;
               min: 1 1;
               ellipsis: -1;
               align: 0.5 0.5;
               text_class: "button";
            }
            offscale;
         }
         description { state: "disabled" 0.0;
            inherit: "default" 0.0;
            color_class: "/fg/disabled/syscon/button/text";
         }
         description { state: "clicked" 0.0;
            inherit: "default" 0.0;
            color_class: "/fg/pressed/syscon/button/text";
         }
         description { state: "focused" 0.0;
            inherit: "default" 0.0;
            color_class: "/fg/selected/syscon/button/text";
         }
      }
      part { name: "sel"; type: RECT; mouse_events: 0;
         scale: 1;
         clip_to: "clip";
         description { state: "default" 0.0;
            color_class: "/bg/selected/syscon/button/bar";
            visible: 0;
            rel2.offset: -1 0;
            rel1.relative: 0.0 1.0;
            align: 0.5 1.0;
            max: 99999 6;
            offscale;
         }
         description { state: "focused" 0.0;
            inherit: "default" 0.0;
            rel1.relative: 0.0 0.5;
            visible: 1;
         }
      }
      part { name: "event"; type: RECT;
         ignore_flags: ON_HOLD;
         description { state: "default" 0.0;
            color: 0 0 0 0; // no cc
         }
         description { state: "disabled" 0.0;
            inherit: "default" 0.0;
            visible: 0;
         }
      }
   }
   programs {
      program { signal: "mouse,down,1"; source: "event";
         action: STATE_SET "clicked" 0.0;
         target: "e.text.label";
      }
      program { signal: "mouse,up,1"; source: "event";
         action: STATE_SET "default" 0.0;
         target: "e.text.label";
      }
      program { signal: "mouse,clicked,1*"; source: "event";
         action: SIGNAL_EMIT "e,action,click" "";
      }
      program { signal: "e,state,disabled"; source: "e";
         action: STATE_SET "disabled" 0.0;
         target: "event";
         target: "icon_clip";
         target: "e.text.label";
      }
      program { signal: "e,state,enabled"; source: "e";
         action: STATE_SET "default" 0.0;
         target: "event";
         target: "icon_clip";
         target: "e.text.label";
      }
      program { signal: "e,state,focused"; source: "e";
         action: STATE_SET "focused" 0.0;
         transition: DECELERATE 0.2 USE_DURATION_FACTOR 1;
         target: "e.text.label";
         target: "sel";
      }
      program { signal: "e,state,unfocused"; source: "e";
         action: STATE_SET "default" 0.0;
         transition: DECELERATE 0.2 USE_DURATION_FACTOR 1;
         target: "e.text.label";
         target: "sel";
      }
   }
}

group { name: "e/modules/syscon/button";
   parts {
      part { name: "base";
         scale: 1;
         description { state: "default" 0.0;
            rel1.relative: 0.05 0.05;
            rel2.relative: 0.95 0.95;
            image.normal: "i-system-shutdown";
            aspect: 1.0 1.0; aspect_preference: BOTH;
            color_class: "/fg/normal/gadgets/syscon";
            offscale;
         }
         description { state: "hilight" 0.0;
            inherit: "default" 0.0;
            color_class: "/fg/selected/gadgets/syscon";
         }
         description { state: "clicked" 0.0;
            inherit: "default" 0.0;
            rel1.relative: 0.07 0.07;
            rel2.relative: 0.93 0.93;
            rel1.offset: 1 1;
            rel2.offset: -2 -2;
            color_class: "/fg/pressed/gadgets/syscon";
         }
      }
   }
   programs {
      program { signal: "mouse,down,1"; source: "base";
         action: STATE_SET "clicked" 0.0;
         target: "base";
      }
      program { signal: "mouse,up,1"; source: "base";
         action: STATE_SET "hilight" 0.0;
         target: "base";
      }
      program { signal: "mouse,in"; source: "base";
         action: STATE_SET "hilight" 0.0;
         target: "base";
      }
      program { signal: "mouse,out"; source: "base";
         action: STATE_SET "default" 0.0;
         target: "base";
      }
      program { signal: "mouse,clicked,1*"; source: "base";
         action: SIGNAL_EMIT "e,action,shutdown,show" "e";
      }
   }
}
